package com.itheima.stream;

import java.util.stream.Stream;

public class Demo3 {
    public static void main(String[] args) {

        Integer[] arr = {1, 2, 3, 2, 3, 2, 2, 4, 2};

        Integer[] newArr = new Integer[arr.length];
        Stream.of(arr).toArray(s -> {
            for (int i = 0; i < arr.length; i++) {
                newArr[i] = arr[i];
            }
            return newArr;
        });
        Stream.of(newArr).distinct().forEach(s -> System.out.println(s));


        // Integer[] array = Stream.of(arr).distinct()
        //.toArray(Integer[]::new);
    }
}

